(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 10.4' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[     28832,       1017]
NotebookOptionsPosition[     21655,        788]
NotebookOutlinePosition[     25703,        900]
CellTagsIndexPosition[     25591,        894]
WindowTitle->Collect2
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[GridBox[{
   {Cell["FEYN CALC SYMBOL", "PacletNameCell"], Cell[TextData[{
     Cell[BoxData[
      ActionMenuBox[
       FrameBox[
        InterpretationBox[Cell[TextData[{
          "See Also",
          StyleBox[" \[FilledDownTriangle]", "AnchorBarArrow",
           StripOnInput->False]
         }]],
         TextCell[
          Row[{"See Also", 
            Style[" \[FilledDownTriangle]", "AnchorBarArrow"]}]]],
        StripOnInput->False], {"\<\"Isolate\"\>":>Documentation`HelpLookup[
       "paclet:FeynCalc/ref/Isolate"]},
       Appearance->None,
       MenuAppearance->Automatic,
       MenuStyle->"SeeAlso"]],
      LineSpacing->{1.4, 0}],
     "\[ThickSpace]\[ThickSpace]\[ThickSpace]\[ThickSpace]\[ThickSpace]\
\[ThickSpace]",
     Cell[BoxData[
      ActionMenuBox[
       FrameBox[
        InterpretationBox[Cell[TextData[{
          "URL",
          StyleBox[" \[FilledDownTriangle]", "AnchorBarArrow",
           StripOnInput->False]
         }]],
         TextCell[
          Row[{"URL", 
            Style[" \[FilledDownTriangle]", "AnchorBarArrow"]}]]],
        StripOnInput->False], {"\<\"FeynCalc/ref/Collect2\"\>":>
       None, "\<\"Copy Wolfram Documentation Center URL\"\>":>
       Module[{DocumentationSearch`Private`nb$}, 
        DocumentationSearch`Private`nb$ = NotebookPut[
           Notebook[{
             Cell["FeynCalc/ref/Collect2"]}, Visible -> False]]; 
        SelectionMove[DocumentationSearch`Private`nb$, All, Notebook]; 
        FrontEndTokenExecute[DocumentationSearch`Private`nb$, "Copy"]; 
        NotebookClose[DocumentationSearch`Private`nb$]; Null], 
       Delimiter, "\<\"Copy web URL\"\>":>
       Module[{DocumentationSearch`Private`nb$}, 
        DocumentationSearch`Private`nb$ = NotebookPut[
           Notebook[{
             Cell[
              BoxData[
               MakeBoxes[
                Hyperlink[
                "http://reference.wolfram.com/language/FeynCalc/ref/Collect2.\
html"], StandardForm]], "Input", TextClipboardType -> "PlainText"]}, Visible -> 
            False]]; SelectionMove[
         DocumentationSearch`Private`nb$, All, Notebook]; 
        FrontEndTokenExecute[DocumentationSearch`Private`nb$, "Copy"]; 
        NotebookClose[DocumentationSearch`Private`nb$]; 
        Null], "\<\"Go to web URL\"\>":>FrontEndExecute[{
         NotebookLocate[{
           URL[
            StringJoin[
             If[
              TrueQ[DocumentationBuild`Make`Private`wsmlinkQ$41599], 
              "http://reference.wolfram.com/system-modeler/", 
              "http://reference.wolfram.com/language/"], 
             "FeynCalc/ref/Collect2", ".html"]], None}]}]},
       Appearance->None,
       MenuAppearance->Automatic,
       MenuStyle->"URLMenu"]],
      LineSpacing->{1.4, 0}]
    }], "AnchorBar"]}
  }]], "AnchorBarGrid",
 GridBoxOptions->{GridBoxItemSize->{"Columns" -> {
     Scaled[0.65], {
      Scaled[0.34]}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, 
   "RowsIndexed" -> {}}},
 CellID->1],

Cell[TextData[{
 Cell["Collect2", "ObjectName"],
 Cell[BoxData[
  InterpretationBox[
   StyleBox[
    GraphicsBox[{},
     BaselinePosition->Baseline,
     ImageSize->{8, 0}],
    CacheGraphics->False],
   Spacer[8]]]],
 Cell[BoxData[""], "ObjectNameTranslation"]
}], "ObjectNameGrid"],

Cell[CellGroupData[{

Cell[BoxData[GridBox[{
   {"", Cell[TextData[{
     Cell[BoxData[
      RowBox[{"Collect2", "[", 
       RowBox[{"expr", ",", " ", "x"}], "]"}]], "InlineFormula"],
     " \[LineSeparator]",
     "collects together terms which are not free of any occurrence of x. \
Collect2[expr, {x1, x2, ...}] (or also Collect2[expr, x1, x2, ...]) collects \
together terms which are not free of any occurrence of x1, x2, .... The \
coefficients are put over a common denominator. If expr is expanded before \
collecting depends on the option Factoring, which may be set to Factor, \
Factor2, or any other function, which is applied to the coefficients. If expr \
is already expanded with respect to x (x1,x2, ...), the option Expanding can \
be set to False."
    }]]}
  }]], "Usage",
 GridBoxOptions->{
 GridBoxBackground->{
  "Columns" -> {{None}}, "ColumnsIndexed" -> {}, "Rows" -> {{None}}, 
   "RowsIndexed" -> {}}},
 CellID->982511436],

Cell[CellGroupData[{

Cell[TextData[Cell[BoxData[
 ButtonBox[Cell[TextData[{
   Cell[BoxData[
    InterpretationBox[
     StyleBox[
      GraphicsBox[{},
       BaselinePosition->Baseline,
       ImageSize->{6, 0}],
      CacheGraphics->False],
     Spacer[6]]]],
   "Details"
  }], "NotesFrameText"],
  Appearance->{Automatic, None},
  BaseStyle->None,
  ButtonFunction:>(FrontEndExecute[{
     FrontEnd`SelectionMove[
      FrontEnd`SelectedNotebook[], All, ButtonCell], 
     FrontEndToken["OpenCloseGroup"], 
     FrontEnd`SelectionMove[
      FrontEnd`SelectedNotebook[], After, CellContents]}]& ),
  Evaluator->None,
  Method->"Preemptive"]]]], "NotesSection",
 WholeCellGroupOpener->True,
 CellGroupingRules->{"SectionGrouping", 50},
 CellID->1891491257],

Cell["", "SectionHeaderSpacer"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Options", "[", "Collect2", "]"}]], "Input",
 CellTags->"Collect2",
 CellLabel->"In[375]:=",
 CellID->538422816],

Cell[BoxData[
 FormBox[
  RowBox[{"{", 
   RowBox[{
    RowBox[{"Denominator", "\[Rule]", "False"}], ",", 
    RowBox[{"Dot", "\[Rule]", "False"}], ",", 
    RowBox[{"FCFactorOut", "\[Rule]", "1"}], ",", 
    RowBox[{"FCVerbose", "\[Rule]", "False"}], ",", 
    RowBox[{"Expanding", "\[Rule]", "True"}], ",", 
    RowBox[{"Factoring", "\[Rule]", "Factor"}], ",", 
    RowBox[{"FactoringDenominator", "\[Rule]", "False"}], ",", 
    RowBox[{"InitialFunction", "\[Rule]", "Identity"}], ",", 
    RowBox[{"IntermediateSubstitutions", "\[Rule]", 
     RowBox[{"{", "}"}]}], ",", 
    RowBox[{"IsolateFast", "\[Rule]", "False"}], ",", 
    RowBox[{"IsolateNames", "\[Rule]", "False"}], ",", 
    RowBox[{"Head", "\[Rule]", "Identity"}], ",", 
    RowBox[{"Numerator", "\[Rule]", "False"}], ",", 
    RowBox[{"TimeConstrained", "\[Rule]", "\[Infinity]"}]}], "}"}], 
  TraditionalForm]], "Output",
 ImageSize->{505, 73},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellTags->"Collect2",
 CellLabel->"Out[375]="]
}, Open  ]]
}, Closed]]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  InterpretationBox[
   StyleBox[
    GraphicsBox[{},
     BaselinePosition->Baseline,
     ImageSize->{6, 0}],
    CacheGraphics->False],
   Spacer[6]]]],
 "Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(1)", "ExampleCount"]
}], "PrimaryExamplesSection",
 WholeCellGroupOpener->True,
 CellTags->"PrimaryExamplesSection",
 CellID->873885773],

Cell[CellGroupData[{

Cell[TextData[{
 "Basic Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(1)", "ExampleCount"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CellID->1208283812],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Collect2", "[", 
  RowBox[{
   RowBox[{"t1", "=", 
    RowBox[{"a", "+", 
     RowBox[{"r", " ", "a"}], "+", 
     RowBox[{
      SuperscriptBox["k", "2"], " ", 
      RowBox[{"f", "[", "a", "]"}]}], "-", 
     RowBox[{"k", " ", 
      RowBox[{"f", "[", "a", "]"}]}], "+", 
     FractionBox["x", "2"], "-", 
     FractionBox["y", "w"]}]}], ",", "a"}], "]"}]], "Input",
 CellTags->"Collect2",
 CellLabel->"In[1]:=",
 CellID->1914400776],

Cell[BoxData[
 FormBox[
  RowBox[{
   RowBox[{
    RowBox[{"(", 
     RowBox[{"k", "-", "1"}], ")"}], " ", "k", " ", 
    RowBox[{"f", "(", "a", ")"}]}], "+", 
   RowBox[{"a", " ", 
    RowBox[{"(", 
     RowBox[{"r", "+", "1"}], ")"}]}], "+", 
   FractionBox[
    RowBox[{
     RowBox[{"w", " ", "x"}], "-", 
     RowBox[{"2", " ", "y"}]}], 
    RowBox[{"2", " ", "w"}]]}], TraditionalForm]], "Output",
 ImageSize->{263, 34},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellTags->"Collect2",
 CellLabel->"Out[1]="]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Collect2", "[", 
  RowBox[{"t1", ",", "a", ",", 
   RowBox[{"Factoring", "\[Rule]", "False"}]}], "]"}]], "Input",
 CellTags->"Collect2",
 CellLabel->"In[2]:=",
 CellID->269033150],

Cell[BoxData[
 FormBox[
  RowBox[{
   RowBox[{
    RowBox[{"(", 
     RowBox[{
      SuperscriptBox["k", "2"], "-", "k"}], ")"}], " ", 
    RowBox[{"f", "(", "a", ")"}]}], "+", 
   RowBox[{"a", " ", 
    RowBox[{"(", 
     RowBox[{"r", "+", "1"}], ")"}]}], "-", 
   FractionBox["y", "w"], "+", 
   FractionBox["x", "2"]}], TraditionalForm]], "Output",
 ImageSize->{238, 31},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellTags->"Collect2",
 CellLabel->"Out[2]="]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Collect2", "[", 
  RowBox[{"t1", ",", "a", ",", 
   RowBox[{"Factoring", "\[Rule]", "Factor"}]}], "]"}]], "Input",
 CellTags->"Collect2",
 CellLabel->"In[3]:=",
 CellID->772013483],

Cell[BoxData[
 FormBox[
  RowBox[{
   RowBox[{
    RowBox[{"(", 
     RowBox[{"k", "-", "1"}], ")"}], " ", "k", " ", 
    RowBox[{"f", "(", "a", ")"}]}], "+", 
   RowBox[{"a", " ", 
    RowBox[{"(", 
     RowBox[{"r", "+", "1"}], ")"}]}], "+", 
   FractionBox[
    RowBox[{
     RowBox[{"w", " ", "x"}], "-", 
     RowBox[{"2", " ", "y"}]}], 
    RowBox[{"2", " ", "w"}]]}], TraditionalForm]], "Output",
 ImageSize->{263, 34},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellTags->"Collect2",
 CellLabel->"Out[3]="]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Collect2", "[", 
  RowBox[{"t1", ",", "a", ",", 
   RowBox[{"Factoring", "\[Rule]", "Simplify"}]}], "]"}]], "Input",
 CellLabel->"In[4]:=",
 CellID->321654602],

Cell[BoxData[
 FormBox[
  RowBox[{
   RowBox[{
    RowBox[{"(", 
     RowBox[{"k", "-", "1"}], ")"}], " ", "k", " ", 
    RowBox[{"f", "(", "a", ")"}]}], "+", 
   RowBox[{"a", " ", 
    RowBox[{"(", 
     RowBox[{"r", "+", "1"}], ")"}]}], "-", 
   FractionBox["y", "w"], "+", 
   FractionBox["x", "2"]}], TraditionalForm]], "Output",
 ImageSize->{240, 31},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellLabel->"Out[4]="]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Collect2", "[", 
  RowBox[{
   RowBox[{
    RowBox[{"2", " ", "a", " ", 
     RowBox[{"(", 
      RowBox[{"b", "-", "a"}], ")"}], " ", 
     RowBox[{"(", 
      RowBox[{"h", "-", "1"}], ")"}]}], "-", 
    RowBox[{
     SuperscriptBox["b", "2"], " ", 
     RowBox[{"(", 
      RowBox[{
       RowBox[{"e", " ", "a"}], "-", "c"}], ")"}]}], "+", 
    SuperscriptBox["b", "2"]}], ",", 
   RowBox[{"{", 
    RowBox[{"a", ",", "b"}], "}"}]}], "]"}]], "Input",
 CellTags->"Collect2",
 CellLabel->"In[5]:=",
 CellID->708606765],

Cell[BoxData[
 FormBox[
  RowBox[{
   RowBox[{"-", 
    RowBox[{"2", " ", 
     SuperscriptBox["a", "2"], " ", 
     RowBox[{"(", 
      RowBox[{"h", "-", "1"}], ")"}]}]}], "-", 
   RowBox[{"a", " ", 
    SuperscriptBox["b", "2"], " ", "e"}], "+", 
   RowBox[{"2", " ", "a", " ", "b", " ", 
    RowBox[{"(", 
     RowBox[{"h", "-", "1"}], ")"}]}], "+", 
   RowBox[{
    SuperscriptBox["b", "2"], " ", 
    RowBox[{"(", 
     RowBox[{"c", "+", "1"}], ")"}]}]}], TraditionalForm]], "Output",
 ImageSize->{344, 18},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellTags->"Collect2",
 CellLabel->"Out[5]="]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Collect2", "[", 
  RowBox[{
   RowBox[{"Expand", "[", 
    SuperscriptBox[
     RowBox[{"(", 
      RowBox[{"a", "-", "b", "-", "c", "-", "d"}], ")"}], "5"], "]"}], ",", 
   "a", ",", 
   RowBox[{"IsolateNames", "\[Rule]", "KK"}]}], "]"}]], "Input",
 CellTags->"Collect2",
 CellLabel->"In[6]:=",
 CellID->741587872],

Cell[BoxData[
 FormBox[
  RowBox[{
   SuperscriptBox["a", "5"], "-", 
   RowBox[{"5", " ", 
    SuperscriptBox["a", "4"], " ", 
    TagBox[
     RowBox[{"KK", "(", "114", ")"}],
     HoldForm]}], "+", 
   RowBox[{"10", " ", 
    SuperscriptBox["a", "3"], " ", 
    TagBox[
     RowBox[{"KK", "(", "115", ")"}],
     HoldForm]}], "-", 
   RowBox[{"10", " ", 
    SuperscriptBox["a", "2"], " ", 
    TagBox[
     RowBox[{"KK", "(", "117", ")"}],
     HoldForm]}], "+", 
   RowBox[{"5", " ", "a", " ", 
    TagBox[
     RowBox[{"KK", "(", "116", ")"}],
     HoldForm]}], "-", 
   TagBox[
    RowBox[{"KK", "(", "118", ")"}],
    HoldForm]}], TraditionalForm]], "Output",
 ImageSize->{513, 19},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellTags->"Collect2",
 CellLabel->"Out[6]="]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"FRH", "[", "%", "]"}]], "Input",
 CellTags->"Collect2",
 CellLabel->"In[7]:=",
 CellID->683646211],

Cell[BoxData[
 FormBox[
  RowBox[{
   SuperscriptBox["a", "5"], "-", 
   RowBox[{"5", " ", 
    SuperscriptBox["a", "4"], " ", 
    RowBox[{"(", 
     RowBox[{"b", "+", "c", "+", "d"}], ")"}]}], "+", 
   RowBox[{"10", " ", 
    SuperscriptBox["a", "3"], " ", 
    SuperscriptBox[
     RowBox[{"(", 
      RowBox[{"b", "+", "c", "+", "d"}], ")"}], "2"]}], "-", 
   RowBox[{"10", " ", 
    SuperscriptBox["a", "2"], " ", 
    SuperscriptBox[
     RowBox[{"(", 
      RowBox[{"b", "+", "c", "+", "d"}], ")"}], "3"]}], "+", 
   RowBox[{"5", " ", "a", " ", 
    SuperscriptBox[
     RowBox[{"(", 
      RowBox[{"b", "+", "c", "+", "d"}], ")"}], "4"]}], "-", 
   SuperscriptBox[
    RowBox[{"(", 
     RowBox[{"b", "+", "c", "+", "d"}], ")"}], "5"]}], 
  TraditionalForm]], "Output",
 ImageSize->{368, 41},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellTags->"Collect2",
 CellLabel->"Out[7]="]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Collect2", "[", 
  RowBox[{
   RowBox[{"Expand", "[", 
    SuperscriptBox[
     RowBox[{"(", 
      RowBox[{"a", "-", "b", "-", "c", "-", "d"}], ")"}], "5"], "]"}], ",", 
   "a", ",", 
   RowBox[{"Head", "\[Rule]", "h"}]}], "]"}]], "Input",
 CellLabel->"In[8]:=",
 CellID->1338628687],

Cell[BoxData[
 FormBox[
  RowBox[{
   RowBox[{"h", "(", 
    SuperscriptBox["a", "5"], ")"}], "-", 
   RowBox[{"5", " ", 
    RowBox[{"h", "(", 
     SuperscriptBox["a", "4"], ")"}], " ", 
    RowBox[{"(", 
     RowBox[{"b", "+", "c", "+", "d"}], ")"}]}], "+", 
   RowBox[{"10", " ", 
    RowBox[{"h", "(", 
     SuperscriptBox["a", "3"], ")"}], " ", 
    SuperscriptBox[
     RowBox[{"(", 
      RowBox[{"b", "+", "c", "+", "d"}], ")"}], "2"]}], "-", 
   RowBox[{"10", " ", 
    RowBox[{"h", "(", 
     SuperscriptBox["a", "2"], ")"}], " ", 
    SuperscriptBox[
     RowBox[{"(", 
      RowBox[{"b", "+", "c", "+", "d"}], ")"}], "3"]}], "+", 
   RowBox[{"5", " ", 
    RowBox[{"h", "(", "a", ")"}], " ", 
    SuperscriptBox[
     RowBox[{"(", 
      RowBox[{"b", "+", "c", "+", "d"}], ")"}], "4"]}], "-", 
   SuperscriptBox[
    RowBox[{"(", 
     RowBox[{"b", "+", "c", "+", "d"}], ")"}], "5"]}], 
  TraditionalForm]], "Output",
 ImageSize->{416, 47},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellLabel->"Out[8]="]
}, Open  ]],

Cell[BoxData[
 RowBox[{"Clear", "[", 
  RowBox[{"t1", ",", "l"}], "]"}]], "Input",
 CellTags->"Collect2",
 CellLabel->"In[9]:=",
 CellID->1111657644],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Collect2", "[", 
  RowBox[{
   RowBox[{"Expand", "[", 
    SuperscriptBox[
     RowBox[{"(", 
      RowBox[{"a", "-", "b", "-", "c"}], ")"}], "3"], "]"}], ",", "a", ",", 
   RowBox[{"Factoring", "\[Rule]", "fun"}]}], "]"}]], "Input",
 CellTags->"Collect2",
 CellLabel->"In[10]:=",
 CellID->1492093352],

Cell[BoxData[
 FormBox[
  RowBox[{
   RowBox[{
    SuperscriptBox["a", "3"], " ", 
    RowBox[{"fun", "(", "1", ")"}]}], "+", 
   RowBox[{
    SuperscriptBox["a", "2"], " ", 
    RowBox[{"fun", "(", 
     RowBox[{
      RowBox[{"-", 
       RowBox[{"3", " ", "b"}]}], "-", 
      RowBox[{"3", " ", "c"}]}], ")"}]}], "+", 
   RowBox[{"a", " ", 
    RowBox[{"fun", "(", 
     RowBox[{
      RowBox[{"3", " ", 
       SuperscriptBox["b", "2"]}], "+", 
      RowBox[{"6", " ", "b", " ", "c"}], "+", 
      RowBox[{"3", " ", 
       SuperscriptBox["c", "2"]}]}], ")"}]}], "+", 
   RowBox[{"fun", "(", 
    RowBox[{
     RowBox[{"-", 
      SuperscriptBox["b", "3"]}], "-", 
     RowBox[{"3", " ", 
      SuperscriptBox["b", "2"], " ", "c"}], "-", 
     RowBox[{"3", " ", "b", " ", 
      SuperscriptBox["c", "2"]}], "-", 
     SuperscriptBox["c", "3"]}], ")"}]}], TraditionalForm]], "Output",
 ImageSize->{422, 42},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellTags->"Collect2",
 CellLabel->"Out[10]="]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"%", " ", "/.", " ", 
  RowBox[{"fun", "\[Rule]", "FactorTerms"}]}]], "Input",
 CellTags->"Collect2",
 CellLabel->"In[11]:=",
 CellID->1964581263],

Cell[BoxData[
 FormBox[
  RowBox[{
   SuperscriptBox["a", "3"], "-", 
   RowBox[{"3", " ", 
    SuperscriptBox["a", "2"], " ", 
    RowBox[{"(", 
     RowBox[{"b", "+", "c"}], ")"}]}], "+", 
   RowBox[{"3", " ", "a", " ", 
    RowBox[{"(", 
     RowBox[{
      SuperscriptBox["b", "2"], "+", 
      RowBox[{"2", " ", "b", " ", "c"}], "+", 
      SuperscriptBox["c", "2"]}], ")"}]}], "-", 
   SuperscriptBox["b", "3"], "-", 
   RowBox[{"3", " ", 
    SuperscriptBox["b", "2"], " ", "c"}], "-", 
   RowBox[{"3", " ", "b", " ", 
    SuperscriptBox["c", "2"]}], "-", 
   SuperscriptBox["c", "3"]}], TraditionalForm]], "Output",
 ImageSize->{469, 21},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellTags->"Collect2",
 CellLabel->"Out[11]="]
}, Open  ]],

Cell[TextData[{
 "The options ",
 StyleBox["IsolateFast", "ExampleText"],
 " allows to save some time when Isolating prefactors, provided that no \
factoring is involved."
}], "Notes",
 CellID->1064433782],

Cell[BoxData[
 RowBox[{
  RowBox[{"exp", "=", 
   RowBox[{
    RowBox[{
     RowBox[{"Sum", "[", 
      RowBox[{
       RowBox[{"h", "[", "i", "]"}], ",", 
       RowBox[{"{", 
        RowBox[{"i", ",", "1", ",", "200000"}], "}"}]}], "]"}], "*", "a"}], 
    "+", 
    RowBox[{
     RowBox[{"Sum", "[", 
      RowBox[{
       RowBox[{"g", "[", "i", "]"}], ",", 
       RowBox[{"{", 
        RowBox[{"i", ",", "1", ",", "200000"}], "}"}]}], "]"}], "*", "b"}], 
    "+", 
    RowBox[{
     RowBox[{"Sum", "[", 
      RowBox[{
       RowBox[{"j", "[", "i", "]"}], ",", 
       RowBox[{"{", 
        RowBox[{"i", ",", "1", ",", "200000"}], "}"}]}], "]"}], "*", 
     "c"}]}]}], ";"}]], "Input",
 CellLabel->"In[12]:=",
 CellID->18062506],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"AbsoluteTiming", "[", 
  RowBox[{"Collect2", "[", 
   RowBox[{"exp", ",", 
    RowBox[{"{", 
     RowBox[{"a", ",", "b", ",", "c"}], "}"}], ",", 
    RowBox[{"Factoring", "\[Rule]", "False"}], ",", 
    RowBox[{"IsolateNames", "\[Rule]", "KK"}], ",", 
    RowBox[{"Expanding", "\[Rule]", "False"}]}], "]"}], "]"}]], "Input",
 CellLabel->"In[13]:=",
 CellID->908574489],

Cell[BoxData[
 FormBox[
  RowBox[{"{", 
   RowBox[{"2.648394`", ",", 
    RowBox[{
     RowBox[{"a", " ", 
      TagBox[
       RowBox[{"KK", "(", "123", ")"}],
       HoldForm]}], "+", 
     RowBox[{"b", " ", 
      TagBox[
       RowBox[{"KK", "(", "124", ")"}],
       HoldForm]}], "+", 
     RowBox[{"c", " ", 
      TagBox[
       RowBox[{"KK", "(", "122", ")"}],
       HoldForm]}]}]}], "}"}], TraditionalForm]], "Output",
 ImageSize->{312, 16},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellLabel->"Out[13]="]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"AbsoluteTiming", "[", 
  RowBox[{"Collect2", "[", 
   RowBox[{"exp", ",", 
    RowBox[{"{", 
     RowBox[{"a", ",", "b", ",", "c"}], "}"}], ",", 
    RowBox[{"Factoring", "\[Rule]", "False"}], ",", 
    RowBox[{"IsolateNames", "\[Rule]", "KK"}], ",", 
    RowBox[{"IsolateFast", "\[Rule]", "True"}], ",", 
    RowBox[{"Expanding", "\[Rule]", "False"}]}], "]"}], "]"}]], "Input",
 CellLabel->"In[14]:=",
 CellID->1760353952],

Cell[BoxData[
 FormBox[
  RowBox[{"{", 
   RowBox[{"1.940384`", ",", 
    RowBox[{
     RowBox[{"a", " ", 
      TagBox[
       RowBox[{"KK", "(", "123", ")"}],
       HoldForm]}], "+", 
     RowBox[{"b", " ", 
      TagBox[
       RowBox[{"KK", "(", "124", ")"}],
       HoldForm]}], "+", 
     RowBox[{"c", " ", 
      TagBox[
       RowBox[{"KK", "(", "122", ")"}],
       HoldForm]}]}]}], "}"}], TraditionalForm]], "Output",
 ImageSize->{310, 16},
 ImageMargins->{{0, 0}, {0, 0}},
 ImageRegion->{{0, 1}, {0, 1}},
 CellLabel->"Out[14]="]
}, Open  ]],

Cell[BoxData[
 RowBox[{"ClearAll", "[", "exp", "]"}]], "Input",
 CellLabel->"In[15]:="]
}, Open  ]],

Cell["", "SectionFooterSpacer"]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  InterpretationBox[
   StyleBox[
    GraphicsBox[{},
     BaselinePosition->Baseline,
     ImageSize->{6, 0}],
    CacheGraphics->False],
   Spacer[6]]]],
 "See Also"
}], "SeeAlsoSection",
 WholeCellGroupOpener->True,
 CellID->1255426704],

Cell[TextData[{
 StyleBox[ButtonBox["Isolate",
  BaseStyle->"Link",
  ButtonData->"paclet:FeynCalc/ref/Isolate",
  ButtonNote->"Isolate"],
  FontFamily->"Verdana"],
 "."
}], "SeeAlso"]
}, Open  ]],

Cell[" ", "FooterCell"]
},
Saveable->False,
ScreenStyleEnvironment->"Working",
WindowSize->{725, 750},
WindowMargins->{{-10, Automatic}, {Automatic, -8}},
WindowTitle->"Collect2",
TaggingRules->{
 "ModificationHighlight" -> False, "ColorType" -> "SymbolColor", "LinkTrails" -> 
  GridBox[{{
      RowBox[{
        ButtonBox[
        "FeynCalc", ButtonData -> "paclet:FeynCalc/guide/FeynCalc", 
         BaseStyle -> {"Link", "DockedLinkTrail"}]}]}}, ColumnAlignments -> 
    Left], "HasOptions" -> False, "ExampleCounter" -> 1, "NeedPlatMsgIn" -> 
  None, "RootCaptions" -> "", 
  "Metadata" -> {
   "built" -> "{2020, 6, 20, 19, 3, 1.002234}", 
    "history" -> {"9.0", "", "", ""}, "context" -> "FeynCalc`", 
    "keywords" -> {}, "specialkeywords" -> {}, 
    "tutorialcollectionlinks" -> {}, "index" -> True, "label" -> 
    "Feyn Calc Symbol", "language" -> "en", "paclet" -> "FeynCalc", "status" -> 
    "None", "summary" -> 
    "Collect2[expr, x] collects together terms which are not free of any \
occurrence of x. Collect2[expr, {x1, x2, ...}] (or also Collect2[expr, x1, \
x2, ...]) collects together terms which are not free of any occurrence of x1, \
x2, .... The coefficients are put over a common denominator. If expr is \
expanded before collecting depends on the option Factoring, which may be set \
to Factor, Factor2, or any other function, which is applied to the \
coefficients. If expr is already expanded with respect to x (x1,x2, ...), the \
option Expanding can be set to False.", "synonyms" -> {}, "tabletags" -> {}, 
    "title" -> "Collect2", "titlemodifier" -> "", "windowtitle" -> "Collect2",
     "type" -> "Symbol", "uri" -> "FeynCalc/ref/Collect2"}, 
  "SearchTextTranslated" -> ""},
CellContext->"Global`",
FrontEndVersion->"10.4 for Linux x86 (64-bit) (April 11, 2016)",
StyleDefinitions->Notebook[{
   Cell[
    StyleData[
    StyleDefinitions -> FrontEnd`FileName[{"Wolfram"}, "Reference.nb"]]], 
   Cell[
    StyleData["Input"], CellContext -> "Global`"], 
   Cell[
    StyleData["Output"], CellContext -> "Global`"]}, Visible -> False, 
  FrontEndVersion -> "10.4 for Linux x86 (64-bit) (April 11, 2016)", 
  StyleDefinitions -> "Default.nb"]
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{
 "Collect2"->{
  Cell[5642, 166, 135, 4, 27, "Input",
   CellTags->"Collect2",
   CellID->538422816],
  Cell[5780, 172, 1026, 24, 94, "Output",
   CellTags->"Collect2"],
  Cell[7500, 232, 459, 15, 50, "Input",
   CellTags->"Collect2",
   CellID->1914400776],
  Cell[7962, 249, 537, 19, 55, "Output",
   CellTags->"Collect2"],
  Cell[8536, 273, 203, 6, 27, "Input",
   CellTags->"Collect2",
   CellID->269033150],
  Cell[8742, 281, 485, 17, 52, "Output",
   CellTags->"Collect2"],
  Cell[9264, 303, 204, 6, 27, "Input",
   CellTags->"Collect2",
   CellID->772013483],
  Cell[9471, 311, 537, 19, 55, "Output",
   CellTags->"Collect2"],
  Cell[10712, 362, 543, 19, 33, "Input",
   CellTags->"Collect2",
   CellID->708606765],
  Cell[11258, 383, 623, 21, 39, "Output",
   CellTags->"Collect2"],
  Cell[11918, 409, 339, 11, 33, "Input",
   CellTags->"Collect2",
   CellID->741587872],
  Cell[12260, 422, 801, 30, 40, "Output",
   CellTags->"Collect2"],
  Cell[13098, 457, 122, 4, 27, "Input",
   CellTags->"Collect2",
   CellID->683646211],
  Cell[13223, 463, 911, 30, 62, "Output",
   CellTags->"Collect2"],
  Cell[15538, 547, 149, 5, 27, "Input",
   CellTags->"Collect2",
   CellID->1111657644],
  Cell[15712, 556, 325, 10, 33, "Input",
   CellTags->"Collect2",
   CellID->1492093352],
  Cell[16040, 568, 1022, 34, 63, "Output",
   CellTags->"Collect2"],
  Cell[17099, 607, 169, 5, 27, "Input",
   CellTags->"Collect2",
   CellID->1964581263],
  Cell[17271, 614, 758, 24, 42, "Output",
   CellTags->"Collect2"]},
 "PrimaryExamplesSection"->{
  Cell[6867, 203, 387, 15, 31, "PrimaryExamplesSection",
   CellTags->"PrimaryExamplesSection",
   CellID->873885773]}
 }
*)
(*CellTagsIndex
CellTagsIndex->{
 {"Collect2", 23924, 838},
 {"PrimaryExamplesSection", 25448, 887}
 }
*)
(*NotebookFileOutline
Notebook[{
Cell[580, 21, 2999, 74, 53, "AnchorBarGrid",
 CellID->1],
Cell[3582, 97, 285, 11, 45, "ObjectNameGrid"],
Cell[CellGroupData[{
Cell[3892, 112, 927, 20, 170, "Usage",
 CellID->982511436],
Cell[CellGroupData[{
Cell[4844, 136, 739, 24, 31, "NotesSection",
 CellGroupingRules->{"SectionGrouping", 50},
 CellID->1891491257],
Cell[5586, 162, 31, 0, 14, "SectionHeaderSpacer"],
Cell[CellGroupData[{
Cell[5642, 166, 135, 4, 27, "Input",
 CellTags->"Collect2",
 CellID->538422816],
Cell[5780, 172, 1026, 24, 94, "Output",
 CellTags->"Collect2"]
}, Open  ]]
}, Closed]]
}, Open  ]],
Cell[CellGroupData[{
Cell[6867, 203, 387, 15, 31, "PrimaryExamplesSection",
 CellTags->"PrimaryExamplesSection",
 CellID->873885773],
Cell[CellGroupData[{
Cell[7279, 222, 196, 6, 26, "ExampleSection",
 CellID->1208283812],
Cell[CellGroupData[{
Cell[7500, 232, 459, 15, 50, "Input",
 CellTags->"Collect2",
 CellID->1914400776],
Cell[7962, 249, 537, 19, 55, "Output",
 CellTags->"Collect2"]
}, Open  ]],
Cell[CellGroupData[{
Cell[8536, 273, 203, 6, 27, "Input",
 CellTags->"Collect2",
 CellID->269033150],
Cell[8742, 281, 485, 17, 52, "Output",
 CellTags->"Collect2"]
}, Open  ]],
Cell[CellGroupData[{
Cell[9264, 303, 204, 6, 27, "Input",
 CellTags->"Collect2",
 CellID->772013483],
Cell[9471, 311, 537, 19, 55, "Output",
 CellTags->"Collect2"]
}, Open  ]],
Cell[CellGroupData[{
Cell[10045, 335, 183, 5, 27, "Input",
 CellID->321654602],
Cell[10231, 342, 444, 15, 52, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[10712, 362, 543, 19, 33, "Input",
 CellTags->"Collect2",
 CellID->708606765],
Cell[11258, 383, 623, 21, 39, "Output",
 CellTags->"Collect2"]
}, Open  ]],
Cell[CellGroupData[{
Cell[11918, 409, 339, 11, 33, "Input",
 CellTags->"Collect2",
 CellID->741587872],
Cell[12260, 422, 801, 30, 40, "Output",
 CellTags->"Collect2"]
}, Open  ]],
Cell[CellGroupData[{
Cell[13098, 457, 122, 4, 27, "Input",
 CellTags->"Collect2",
 CellID->683646211],
Cell[13223, 463, 911, 30, 62, "Output",
 CellTags->"Collect2"]
}, Open  ]],
Cell[CellGroupData[{
Cell[14171, 498, 308, 10, 33, "Input",
 CellID->1338628687],
Cell[14482, 510, 1041, 34, 68, "Output"]
}, Open  ]],
Cell[15538, 547, 149, 5, 27, "Input",
 CellTags->"Collect2",
 CellID->1111657644],
Cell[CellGroupData[{
Cell[15712, 556, 325, 10, 33, "Input",
 CellTags->"Collect2",
 CellID->1492093352],
Cell[16040, 568, 1022, 34, 63, "Output",
 CellTags->"Collect2"]
}, Open  ]],
Cell[CellGroupData[{
Cell[17099, 607, 169, 5, 27, "Input",
 CellTags->"Collect2",
 CellID->1964581263],
Cell[17271, 614, 758, 24, 42, "Output",
 CellTags->"Collect2"]
}, Open  ]],
Cell[18044, 641, 205, 6, 49, "Notes",
 CellID->1064433782],
Cell[18252, 649, 732, 26, 45, "Input",
 CellID->18062506],
Cell[CellGroupData[{
Cell[19009, 679, 392, 10, 45, "Input",
 CellID->908574489],
Cell[19404, 691, 540, 20, 37, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[19981, 716, 447, 11, 45, "Input",
 CellID->1760353952],
Cell[20431, 729, 540, 20, 37, "Output"]
}, Open  ]],
Cell[20986, 752, 87, 2, 27, "Input"]
}, Open  ]],
Cell[21088, 757, 31, 0, 29, "SectionFooterSpacer"]
}, Open  ]],
Cell[CellGroupData[{
Cell[21156, 762, 270, 12, 31, "SeeAlsoSection",
 CellID->1255426704],
Cell[21429, 776, 184, 7, 56, "SeeAlso"]
}, Open  ]],
Cell[21628, 786, 23, 0, 41, "FooterCell"]
}
]
*)

(* End of internal cache information *)

